home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
manchest.lha
/
MANCHESTER
/
manchester
/
2.2
/
SetInspector.st
< prev
next >
Wrap
Text File
|
1993-07-24
|
3KB
|
140 lines
" NAME SetInspector
AUTHOR tph@cs.man.ac.uk
FUNCTION sensible version
ST-VERSIONS 2.2
PREREQUISITES
CONFLICTS
DISTRIBUTION world
VERSION 1.1
DATE 22 Jan 1989
SUMMARY SetInspector
extends the inspector to work sensibly for Sets. This
goodie is based on a version which appeared on Usenet.(2.2).TPH
"!
Inspector subclass: #SetInspector
instanceVariableNames: 'topView listView '
classVariableNames: 'NoSelectionMenu YesSelectionMenu '
poolDictionaries: ''
category: 'Interface-SetInspector'!
!SetInspector methodsFor: 'initialization'!
listView: aView
^listView _ aView!
topView: aView
^topView _ aView! !
!SetInspector methodsFor: 'field list'!
fieldMenu
field == nil
ifTrue:
[NoSelectionMenu == nil ifTrue: [NoSelectionMenu _ ActionMenu labels: 'first non-empty' selectors: #(firstNonEmpty )].
^NoSelectionMenu]
ifFalse:
[YesSelectionMenu == nil ifTrue: [YesSelectionMenu _ ActionMenu
labels: 'inspect\prev non-empty\next non-empty' withCRs
lines: #(1 )
selectors: #(inspectField prevNonEmpty nextNonEmpty )].
^YesSelectionMenu]! !
!SetInspector methodsFor: 'menu commands'!
firstNonEmpty
1 to: object basicSize do: [:i | (object basicAt: i)
~= nil
ifTrue:
[listView moveSelectionBox: i + 2.
listView changeModelSelection: i + 2.
^self]].
topView flash!
nextNonEmpty
| idx |
field first isDigit ifFalse: [^self firstNonEmpty].
idx _ Integer readFromString: field.
idx + 1 to: object basicSize do: [:i | (object basicAt: i)
~= nil
ifTrue:
[listView moveSelectionBox: i + 2.
listView changeModelSelection: i + 2.
^self]].
topView flash!
prevNonEmpty
| idx |
field first isDigit ifFalse: [^self firstNonEmpty].
idx _ Integer readFromString: field.
idx - 1
to: 1
by: -1
do: [:i | (object basicAt: i)
~= nil
ifTrue:
[listView moveSelectionBox: i + 2.
listView changeModelSelection: i + 2.
^self]].
topView flash! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
SetInspector class
instanceVariableNames: ''!
!SetInspector class methodsFor: 'initialization'!
flushMenus
YesSelectionMenu _ NoSelectionMenu _ nil! !
InspectorView subclass: #SetInspectorView
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Interface-SetInspector'!
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
SetInspectorView class
instanceVariableNames: ''!
!SetInspectorView class methodsFor: 'instance creation'!
view: anInspector in: area of: superView
"Create proportioned List and Code views on anInspector in area of
superView "
| mid |
mid _ area left + (area width * 0.3).
anInspector topView: superView.
superView
addSubView: (anInspector listView: (SelectionInListView
on: anInspector
printItems: anInspector printItems
oneItem: false
aspect: #field
change: #field:
list: #fieldList
menu: #fieldMenu
initialSelection: #field))
in: (area copy right: mid)
borderWidth: 1.
superView
addSubView: (CodeView
on: anInspector
aspect: #text
change: #acceptText:from:
menu: #textMenu
initialSelection: nil)
in: (area copy left: mid)
borderWidth: 1! !'From Smalltalk-80, version 2, of April 1, 1983 on 23 June 1987 at 7:25:59 pm'!
!Set methodsFor: 'user interface'!
inspect
SetInspectorView open: (SetInspector inspect: self)! !